@import './variables.scss';
@import './mixins.scss';

// 重置样式
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: $font-family;
    font-size: $font-size-sm;
    line-height: $line-height-normal;
    color: $text-primary;
    background-color: $background-primary;
    overflow-x: hidden;
}

// 链接样式
a {
    color: $primary-color;
    text-decoration: none;
    @include transition;

    &:hover {
        color: $primary-hover;
    }

    &:active {
        color: $primary-active;
    }
}

// 标题样式
h1,
h2,
h3,
h4,
h5,
h6 {
    margin: 0;
    font-weight: $font-weight-semibold;
    line-height: $line-height-tight;
    color: $text-primary;
}

h1 {
    font-size: $font-size-xxl;
}

h2 {
    font-size: $font-size-xl;
}

h3 {
    font-size: $font-size-lg;
}

h4 {
    font-size: $font-size-md;
}

h5 {
    font-size: $font-size-sm;
}

h6 {
    font-size: $font-size-xs;
}

// 段落样式
p {
    margin: 0;
    line-height: $line-height-normal;
}

// 列表样式
ul,
ol {
    margin: 0;
    padding: 0;
    list-style: none;
}

// 图片样式
img {
    max-width: 100%;
    height: auto;
    vertical-align: middle;
    border-style: none;
}

// 按钮样式
button {
    border: none;
    background: none;
    padding: 0;
    cursor: pointer;
    font: inherit;
    color: inherit;
    outline: none;
}

// 输入框样式
input,
textarea,
select {
    font: inherit;
    color: inherit;
    outline: none;
    border: none;
    background: none;
}

// 表格样式
table {
    border-collapse: collapse;
    border-spacing: 0;
    width: 100%;
}

// 代码样式
code {
    font-family: $font-family-code;
    font-size: 0.9em;
    padding: 0.2em 0.4em;
    background-color: $background-tertiary;
    border-radius: $border-radius-sm;
}

pre {
    font-family: $font-family-code;
    font-size: 0.9em;
    padding: $spacing-md;
    background-color: $background-tertiary;
    border-radius: $border-radius-md;
    overflow-x: auto;
    @include scrollbar;
}

// 滚动条样式
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: $border-color;
    border-radius: 4px;

    &:hover {
        background: $border-color-hover;
    }
}

// 选择文本样式
::selection {
    background-color: $primary-light;
    color: $primary-color;
}

// 占位符样式
::placeholder {
    color: $text-tertiary;
    opacity: 1;
}

// 禁用状态
:disabled {
    @include disabled;
}

// 动画
@include keyframes(fade-in) {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@include keyframes(fade-out) {
    from {
        opacity: 1;
    }

    to {
        opacity: 0;
    }
}

@include keyframes(slide-in) {
    from {
        transform: translateY(-100%);
    }

    to {
        transform: translateY(0);
    }
}

@include keyframes(slide-out) {
    from {
        transform: translateY(0);
    }

    to {
        transform: translateY(-100%);
    }
}

// 工具类
.text-center {
    text-align: center;
}

.text-left {
    text-align: left;
}

.text-right {
    text-align: right;
}

.text-primary {
    color: $text-primary;
}

.text-secondary {
    color: $text-secondary;
}

.text-tertiary {
    color: $text-tertiary;
}

.text-disabled {
    color: $text-disabled;
}

.bg-primary {
    background-color: $background-primary;
}

.bg-secondary {
    background-color: $background-secondary;
}

.bg-tertiary {
    background-color: $background-tertiary;
}

.flex {
    @include flex;
}

.flex-center {
    @include flex-center;
}

.flex-between {
    @include flex-between;
}

.flex-column-center {
    @include flex-column-center;
}

.w-100 {
    width: 100%;
}

.h-100 {
    height: 100%;
}

.m-0 {
    margin: 0;
}

.p-0 {
    padding: 0;
}

// 响应式工具类
@each $breakpoint, $width in $breakpoints {
    @include responsive($breakpoint) {
        .hidden-#{$breakpoint} {
            display: none !important;
        }
    }
}